<?php


namespace dsp\facade;


class Facade
{

    protected $subsystem1;
    protected $subsystem2;

    public function __construct(
        SubSystem1 $subsystem1 = null,
        SubSystem2 $subsystem2 = null)
    {
        $this->subsystem1 = $subsystem1;
        $this->subsystem2 = $subsystem2;
    }

    public function operation(): string
    {
        $result = "Facade initializes subsystems:\n";
        $result .= $this->subsystem1->operation1();
        $result .= $this->subsystem2->operation1();
        $result .= "Facade orders subsystems to perform the action:\n";
        $result .= $this->subsystem1->operationN();
        $result .= $this->subsystem2->operationZ();

        return $result;
    }

}